package cc.fine.svc.main.controller.rel;


import cc.fine.svc.common.utils.R;
import cc.fine.svc.main.bean.FineMessage;
import cc.fine.svc.main.bean.po.RelUserVideoShare;
import cc.fine.svc.main.utils.MqUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wyihe
 * @since 2023-10-28
 */
@RestController
@RequestMapping("/video-share")
@Api(description = "用户分享视频")
public class RelUserVideoShareController {

    @Autowired
    private MqUtils mqUtils;

    @ApiOperation("用户分享视频")
    @GetMapping("/{userId}/{videoId}")
    public R share(@PathVariable("userId") String userId,
                   @PathVariable("videoId") String videoId) {

        mqUtils.send(new FineMessage(
                FineMessage.VIDEO_SHARE,
                new RelUserVideoShare(null, userId, videoId)
                ));

        return R.ok();
    }

}

